package com.mzy.xmyx.acl.controller;

import com.mzy.xmyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Api(tags = "登录接口")
@RestController
@RequestMapping("/admin/acl/index")
@CrossOrigin
public class IndexController {

    // 1. 登录
    @ApiOperation("登录")
    @PostMapping("/login")
    public Result login() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("token", "admin-token");
        return Result.ok(map);
    }

    // 2. 获取用户信息（根据token)
    @ApiOperation("获取用户信息")
    @GetMapping("/info")
    public Result info() {
        Map<String,Object> map = new HashMap<>();
        map.put("name","mizeyu");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.ok(map);
    }
    // 3. 登出
    @ApiOperation("登出")
    @PostMapping("/logout")
    public Result logout() {
        return Result.ok(null);
    }

}
